	$(document).ready(function(){
		$(".tab").find("dt a").click(function(){
			dt = $(this).parent("dt");
			tab = $(this).attr("data-option-value");
			tab = tab.replace(/[\#]/,'');
			if(!dt.hasClass("active")){
				$(".tab").find("dt").removeClass("active");
				dt.addClass("active");
				$(".tab_content").css("display","none");
				$("."+tab).show();
			}
		});
	});
							
	$(document).ready(function(){
		$("#user").blur(function(){
			var user = $("#user").val();
			var len = user.length;
			if(len == '0' || len < 4){
				$("#user").parent("td").next("td.tips").html("登录名得多于4位").css("color","#000");
			}else{
				$.ajax({
					type:'post',
					data:'user='+user,
					url:'ajax.php',
					success:function(data){
						if(data ==1){
							$("#user").parent("td").next("td.tips").html("该登录名可使用").css("color","#000");
						}else if(data == 2){
							$("#user").parent("td").next("td.tips").html("该登录名已被注册").css("color","red");
						}
					}
				});
			}
		});
						
		$("#pwd").blur(function(){
			var pwd = $("#pwd").val();
			var pwd_len = pwd.length;
			if(pwd_len == '0' || pwd_len < 6){
				$("#pwd").parent("td").next("td.tips").html("密码不得少于6位").css("color","red");
			}else{
				$("#pwd").parent("td").next("td.tips").html("密码格式正确").css("color","black");
			}
		});
								
		$("#repeat_pwd").blur(function(){
			var rpwd = $("#repeat_pwd").val();
			var rpwd_len = rpwd.length;
			var pwd = $("#pwd").val();
			var pwd_len = pwd.length;
			if(rpwd_len != pwd_len || rpwd != pwd){
				$("#repeat_pwd").parent("td").next("td.tips").html("两次密码不相同").css("color","red");
			}else if (rpwd_len == '0'){
				$("#repeat_pwd").parent("td").next("td.tips").html("请再输入密码").css("color","red");
			}else if(rpwd == pwd){
				$("#repeat_pwd").parent("td").next("td.tips").html("密码输入正确").css("color","#000");
			}
		});
							
		$("#email").blur(function(){
			var email = $("#email").val();
			var email_preg = /^[A-Za-z0-9_-]+@[A-Za-z0-9_-]+(\.[A-Za-z0-9]+)+$/;
			if(email != ''){
				if(!email.match(email_preg)){
					$("#email").parent("td").next("td.tips").html("请输入正确邮箱").css("color","red");
				}else{
					$.ajax({
						type:'post',
						data:'email='+email,
						url:'ajax.php',
						success:function(data){
							if(data ==1){
								$("#email").parent("td").next("td.tips").html("该邮箱已被注册").css("color","red");
							}else if(data == 2){
								$("#email").parent("td").next("td.tips").html("该邮箱可以使用").css("color","#000");
							}
						}
					});
				}
			}else{
				$("#email").parent("td").next("td.tips").html("");
			}
		});
	});//??AJAX